Repository navigation
feat(ai): OpenAI-compatible provider for local and third-party models - #48
Merged
Merged
Conversation
… models Adds a third AI provider, "OpenAI-compatible", for Ollama, LM Studio, OpenRouter, vLLM and other servers that speak the Chat Completions API. It has its own server URL, model and optional encrypted key, and uses @ai-sdk/openai-compatible, which never reads provider environment variables, so ANTHROPIC_API_KEY / OPENAI_API_KEY are never sent to a user-supplied URL. A saved key is bound to the URL it was saved with: saving a different URL clears it unless a new key is sent. Anthropic and OpenAI gateways keep working through the SDKs' standard ANTHROPIC_BASE_URL / OPENAI_BASE_URL variables, now documented and covered by a test. AI statement parsing stays on Anthropic and OpenAI, which accept PDFs and strict structured output. Replaces #19; thanks to @fiandev for the proposal.
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds custom AI provider support, replacing #19 with a narrower design.
What's new
ANTHROPIC_BASE_URL/OPENAI_BASE_URLenv vars. These already worked but were undocumented; they're now in the README and.env.exampleand pinned by a test.Security
ANTHROPIC_API_KEYorOPENAI_API_KEY. It uses@ai-sdk/openai-compatible, which reads no environment variables, and it has no env key of its own.Scope
provider: "compatible"there.@ai-sdk/openai-compatibleis pinned to 3.0.46, which shares@ai-sdk/provider/provider-utilswith the installed@ai-sdk/openai. It adds no new transitive packages and is Apache-2.0.Tests
<url>/chat/completionswith no Authorization header and no env key.pnpm format:check,pnpm typecheck,pnpm test(614 tests), the license gate andpnpm buildall pass locally.Not included: the Markdown rendering of Ask Journal answers from #19. If wanted, it should reuse the existing
<Markdown>component in a separate PR.